package c.c.a;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import c.c.a.k1.b;
import com.huawei.hms.analytics.core.crypto.AesCipher.AesLen;

public abstract class q0<SERVICE> implements d1 {
    public final String a;
    public p0<Boolean> b = new a();

    public class a extends p0<Boolean> {
        public Object a(Object[] objArr) {
            boolean z = false;
            Context context = (Context) objArr[0];
            try {
                if (context.getPackageManager().getPackageInfo(q0.this.a, AesLen.ROOTKEY_COMPONET_LEN) != null) {
                    z = true;
                }
            } catch (Throwable unused) {
            }
            return Boolean.valueOf(z);
        }
    }

    public q0(String str) {
        this.a = str;
    }

    public abstract b<SERVICE, String> a();

    public boolean a(Context context) {
        if (context == null) {
            return false;
        }
        return ((Boolean) this.b.b(context)).booleanValue();
    }

    public c.c.a.d1.a b(Context context) {
        String str = (String) new k1(context, c(context), a()).a();
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        c.c.a.d1.a aVar = new c.c.a.d1.a();
        aVar.a = str;
        return aVar;
    }

    public abstract Intent c(Context context);
}
